function xout=subsref(x,s)
  nx = size(x);
  sd = s;
  sd.subs = {':',s.subs{:}};
  switch s.type
    case '()'
      % xout.v = x.v(s.subs{:});
      xout.v = subsref(x.v,s);
      xout.d = subsref(x.d,sd);
   otherwise
    error('wrong index type for_ deriv1');
  end
  
  if(nnz(xout.d)==0)
    xout = xout.v;
  else
    xout = class(xout,'der1');
  end
  
